package com.maikang.exammall.entity.dto.order;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.maikang.exammall.entity.OrderItem;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.validator.constraints.Length;

import javax.validation.Valid;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.Pattern;
import java.util.List;


@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class CreateOrderInputDTO {

    @NotEmpty
    @Valid // validate recursively
    private List<OrderItem> orderItems;

    @ApiModelProperty("预约人电话")
    @Pattern(regexp = "1[3|4|5|7|8][0-9]\\d{8}")
    private String mobile;

    @ApiModelProperty("预约备注")
    @Length(max = 256)
    private String remark;

    @ApiModelProperty("该订单涉及到的cartId")
    private List<Long> cartIds;

    @ApiModelProperty(hidden = true)
    private String ip;
}
